/*
 *  ATimecodeClip.cpp
 *  libavid
 *
 *  Created by Peter on 23.02.12.
 *  Copyright 2012 __MyCompanyName__. All rights reserved.
 *
 */
#include "ATimecodeClip.h"
#include "AStream.h"

A_IMPLEMENT_CLASS( 'TCCP', ATimecodeClip, AClip );

void ATimecodeClip::readFromStream( AStream& str, const AObjDoc& objd )
{
	AClip::readFromStream( str, objd );
	
	UInt8 tagMark, version, endTagMark;
	
	str.readPod( tagMark );
	str.readPod( version );
	
	TR_ASSERT( tagMark == 0x02 );
	TR_ASSERT( version == 0x01 );
	
	str.readPod( _flags );
	str.readPod( _fps );
	
	// Two uchar + 1 ulong of explicitly unused data
	str.skip( 1 + 1 + 4 );
	
	str.readPod( _startTc );
	
	str.readPod( endTagMark );
	//TR_ASSERT( endTagMark == 0x03 );
}

void ATimecodeClip::dump( std::ostream& str ) const
{
	str << "ATimecodeClip {" << std::endl;
	str << "\t";
	AClip::dump( str );
	str << "\t_flags: " << _flags << std::endl;
	str << "\t_fps: " << _fps << std::endl;
	str << "\t_startTc: " << _startTc << std::endl;
	str << "}" << std::endl;
}